package com.runen.infinitemovement.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.widget.RelativeLayout;


import androidx.core.widget.NestedScrollView;

/**
 * Create by LiaoDuanHong
 * Create on 2020/1/1 17:04
 */
public class MapContainer extends RelativeLayout {
    private NestedScrollView scrollView;

    public MapContainer(Context context) {
        super(context);
    }


    public MapContainer(Context context, AttributeSet attrs) {
        super(context, attrs);
    }



    public void setScrollView(NestedScrollView scrollView) {

        this.scrollView = scrollView;
    }


    @Override

    public boolean onInterceptTouchEvent(MotionEvent ev) {

        if (ev.getAction() == MotionEvent.ACTION_UP) {
            scrollView.requestDisallowInterceptTouchEvent(false);

        } else {
            scrollView.requestDisallowInterceptTouchEvent(true);

        }
        return false;
    }


    @Override

    public boolean onTouchEvent(MotionEvent event) {
        return true;
    }
}
